#!/bin/bash

# 定义备份和日志文件的路径
BACKUP_PATH="/opt/oracle/backup"
LOG_FILE="/tmp/rmantmp.log"

# 开始RMAN备份操作
rman target / <<EOF >"$LOG_FILE"
run {
 CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
 CONFIGURE CONTROLFILE AUTOBACKUP ON;
}
EOF
# 检查日志文件，确认备份操作是否成功
if grep -q "RMAN-" "$LOG_FILE"; then
  echo "失败：$LOG_FILE"
else
  echo "成功"
fi
exit
